package cn.kami.dbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class OracleDatabaseConnection implements DatabaseConnection{
	public static final String DBDRIVER = "oracle.jdbc.driver.OracleDriver";
	public static final String DBURL = "jdbc:oracle:thin:@localhost:1521:orcl";
	public static final String DBUSER = "battery";
	public static final String DBPASSWORD = "akbingo";

	private Connection conn = null;
	public OracleDatabaseConnection(){
		try{
			Class.forName(DBDRIVER);
			conn = DriverManager.getConnection(DBURL,DBUSER,DBPASSWORD);
		}catch(Exception e){
			e.printStackTrace();
		}
	}

	public Connection getConnection(){
		return this.conn;
	}

	public void close(){
		if(this.conn != null){
			try{
				this.conn.close();
			}catch(SQLException e){
				e.printStackTrace();
			}
		}
	}
}
